// miniProtobuf.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Person_a.h"


void main_1()
{
	//CMiniPb_person pp;
	//pp.set_name("hello");
	//pp.set_age(2);
	//pp.add_skill("play");
	//pp.add_skill("check");
	//char temp[1024] = "";
	//unsigned int len = 0;
	//pp.serialize(temp, len);
	//CMiniPb_person pb ;
	//if (pb.parse(temp, len))
	//{
	//	int d = 0;
	//}
	//char temp2[1024] = "";
	//unsigned int len2 = 0;
	//pp.serialize(temp2, len2);
	//if (len==len2 && memcmp(temp2,temp,len)==0)
	//{
	//	int d=0;
	//}
}

void main_2()
{
	int i = -1;
	unsigned int i2 = (unsigned int)i;
	int i3 = i2;
	int i4 = i3>>1;
	int i5 = i2>>1;
	int i6 = -0xffff;
	int i7 = i6>>5;
	unsigned int i8 = 0xffffffff;
	unsigned int i9 = i8>>8;
	int i10  = i8>>8;
	int i11 = (unsigned int)i6>>5;
	int i12 = ((unsigned int)i6)>>5;
	int dddd = 0;
}

void main_3()
{
	//CEasyFormat cef;
	//int i = 0xffff;
	//int i2 = 0xfff;
	//int i3 = 0xff;
	//int i4 = 0xf;
	//int i5 = 0xfffff;
	//int i6 = 0xffffff;
	//int i7 = 0xfffffff;
	//int i8 = 0xffffffff;
	//int64 i9 = 0xffffffffffffff;
	//int64 d,d2,d3,d4,d5,d6,d7,d8,d9 =0;
	//char buf[10] = "";
	//cef.write_varint64(i, buf);
	//cef.parse_varint64(d, buf);
	//char buf2[10] = "";
	//cef.write_varint64(i2, buf2);
	//cef.parse_varint64(d2, buf2);
	//char buf3[10] = "";
	//cef.write_varint64(i3, buf3);
	//cef.parse_varint64(d3, buf3);
	//char buf4[10] = "";
	//cef.write_varint64(i4, buf4);
	//cef.parse_varint64(d4, buf4);
	//char buf5[10] = "";
	//cef.write_varint64(i5, buf5);
	//cef.parse_varint64(d5, buf5);
	//char buf6[10] = "";
	//cef.write_varint64(i6, buf6);
	//cef.parse_varint64(d6, buf6);
	//char buf7[10] = "";
	//cef.write_varint64(i7, buf7);
	//cef.parse_varint64(d7, buf7);
	//char buf8[10] = "";
	//cef.write_varint64((unsigned int )i8, buf8);
	//cef.parse_varint64(d8, buf8);
	//char buf9[24] = "";
	//cef.write_varint64(i9, buf9);
	//cef.parse_varint64(d9, buf9);
	//int ddd = 0;
}

void main_4()
{
//#define AA(a) 4
//#define BB(a) 7
//#define CC(a) #if a>10	AA(a) #else BB(a) #endif
//
//	int a = CC(10);
//	int b = CC(2);
//	int ddd = 0;
}

void main_5()
{
	CMiniPb_person person;
	CMiniPb_person p2;
	person.set_age(232);
	person.set_name("hello");
	//person.set_phoneNo("123454");
	person.add_skill("eat");
	person.add_skill("pee");
	char buf[1024] = "";
	char buf2[1024] = "";
	unsigned int len,len2 = 0;
	if ((len = person.serialize(buf, 1024)) > 0)
	{
		if (p2.parse(buf, len))
			len2 = p2.serialize(buf2, 1024);
		if ((len==len2) && (0 == memcmp(buf, buf2,len)))
		{
			int ddddddd=0;
		}
	}
}
void main_6()
{
	CMiniPb_person person;
	person.set_age(232);
	person.set_name("hello");
	person.add_skill("eat");
	person.add_skill("pee");
	char buf3[1024]="";
	person.serialize(buf3, 1024);

	CMiniPb_student ps,ps2;
	ps.set_classc(23);
	ps.set_school("mit");
	ps.set_who(person);
	char buf[1024] = "";
	char buf2[1024] = "";
	unsigned int l1,l2=0;
	l1 = ps.serialize(buf, 1024);
	ps2.parse(buf,l1);
	l2 = ps2.serialize(buf2, 1024);
	if (l1==l2 && memcmp(buf,buf2, l1)==0)
	{
		int dddd=3;
	}
	int ddd = 2;
}

int _tmain(int argc, _TCHAR* argv[])
{
	main_6();
	return 0;
}

